home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PCMania 45
/
PCMania CD45_1.iso
/
vb4wm
/
vb4-4.cab
/
alarm.frm
next >
Wrap
Text File
|
1995-10-16
|
3KB
|
104 lines
VERSION 4.00
Begin VB.Form AlarmForm
BorderStyle = 1 'Fixed Single
Caption = "Despertador"
ClientHeight = 780
ClientLeft = 1230
ClientTop = 1635
ClientWidth = 2685
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 1185
Icon = "ALARM.frx":0000
Left = 1170
LinkTopic = "Form2"
MaxButton = 0 'False
ScaleHeight = 780
ScaleWidth = 2685
Top = 1290
Width = 2805
Begin VB.Timer Timer1
Interval = 500
Left = 2130
Top = 120
End
Begin VB.Label lblTime
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 12
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 0
Top = 120
Width = 2415
End
End
Attribute VB_Name = "AlarmForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Dim AlarmTime
Const conMinimized = 1
Private Sub Form_Click()
AlarmTime = InputBox("Introduzca la hora de la alarma", "Alarma VB", AlarmTime)
If AlarmTime = "" Then Exit Sub
If Not IsDate(AlarmTime) Then
MsgBox "La hora que ha introducido no es vßlida."
Else ' La cadena que devuelve InputBox es una hora vßlida,
AlarmTime = CDate(AlarmTime) ' Se almacena como un valor fecha/hora en la variable AlarmTime.
End If
End Sub
Private Sub Form_Load()
AlarmTime = ""
End Sub
Private Sub Form_Resize()
If WindowState = conMinimized Then ' Si el formulario estß minimizado, muestra la hora en el tφtulo.
SetCaptionTime
Else
Caption = "Despertador"
End If
End Sub
Private Sub SetCaptionTime()
Caption = Format(Time, "Medium Time") ' Muestra la hora usando el formato de hora mediano.
End Sub
Private Sub Timer1_Timer()
Static AlarmSounded As Integer
If lblTime.Caption <> CStr(Time) Then
' Ya es un segundo diferente que el mostrado en pantalla.
If Time >= AlarmTime And Not AlarmSounded Then
Beep
MsgBox "Alarma a las " & Time
AlarmSounded = True
ElseIf Time < AlarmTime Then
AlarmSounded = False
End If
If WindowState = conMinimized Then
' Si estß minimizado, actualiza el tφtulo del formulario cada minuto.
If Minute(CDate(Caption)) <> Minute(Time) Then SetCaptionTime
Else
' Si no lo estß, actualiza la etiqueta del tφtulo en el formulario cada segundo.
lblTime.Caption = Time
End If
End If
End Sub